
import { useTranslation } from 'react-i18next'
import { Link, useNavigate ,useParams } from "react-router-dom";
import HeaderTitle from "../login/header";
import style from "./index.module.less"
import { EyeInvisibleOutline, EyeOutline } from "antd-mobile-icons"
import React, { Fragment, useState, useEffect } from 'react'
import {
	Form,
	Input,
	Checkbox,
	Button,
	Toast,

} from 'antd-mobile'
import { getactivitycontent } from "@/apis/user.js"

import banner1 from "../../static/1.jpg"
import banner5 from "../../static/5.jpg"

const Newsdetail = (props) => {
	const navigate = useNavigate()
	const { id } = useParams();
	const [detail,setDetail]=useState([]);
	useEffect(() => {
		let ids = id;
		console.log("初始化----优惠活动");
		// setFlag(true);
		getactivitycontent({
				id:ids
			}).then(res => {
		
			if (res.status.errorCode == 0) {
				setDetail(res.data.data[0])
	
			}
		})
		setTimeout(()=>{
			if (window.scrollTo) {
				window.scrollTo(0, 0);
			} else if (document.body.scrollTop) {
				document.body.scrollTop = 0;
			} else {
				document.documentElement.scrollTop = 0;
			}
			document.getElementById('root').scrollIntoView(true);
			document.getElementById('body').scrollIntoView(true);
		},0)
		return ()=>{console.log('初始化----个人中心')}
	  }, []);
	  const { t } = useTranslation();
	return (
		<React.Fragment>
			<HeaderTitle title={detail.title} right_title={t('agent.title2')}/>
			<div className={style['main']}>
				<div className={style['content']}>
					<div className={style['newsBox']}>
						{/* <img className={style['banimg']} src={banner1} alt="" />
						<img className={style['banimg']} src={banner5} alt="" /> */}
						<div dangerouslySetInnerHTML={{__html:detail.rule_content}}/>
					</div>
				</div>
			</div>

		</React.Fragment>
	)
}


export default Newsdetail
